"""Build versioned extent allocator"""

FILES = ['vea_alloc.c', 'vea_api.c', 'vea_free.c', 'vea_hint.c', 'vea_init.c', 'vea_util.c']


def scons():
    """Execute build"""
    Import('env', 'prereqs')

    env.AppendUnique(LIBPATH=[Dir('.')])

    if not prereqs.server_requested():
        return

    denv = env.Clone()
    denv.require('pmdk')

    denv.Append(CPPDEFINES=['-DDAOS_PMEM_BUILD'])
    denv.d_static_library('vea', FILES, LIBS=['daos_common_pmem'])

    if prereqs.test_requested():
        SConscript('tests/SConscript', exports='denv')


if __name__ == "SCons.Script":
    scons()
